#include "glare.core.DrawContext.h"
#include "glare.core.ColourValue.h"

#include "Demo.Scene.h"

using namespace Glare;

class HelloWindow : public DemoScene
{
public : virtual void Initialize(Driver* driver, PlatformWindow* platform_window) 
		 {
			 _driver = driver;

			 try
			 {
				 _render_window = driver->CreateRenderWindow(platform_window);
				 _render_window->Initialize();
				 _render_window->SetPresentSyncInterval(1);

				 _immediate_context = _driver->GetImmediateDrawContext();

				 _viewport.Left = 0;
				 _viewport.Top = 0;
				 _viewport.Width = (float)_render_window->GetCanvasWidth();
				 _viewport.Height = (float)_render_window->GetCanvasHeight();
				 _viewport.MinDepth = 0;
				 _viewport.MaxDepth = 1;
			 }
			 catch (Exception e)
			 {
				 _driver->WriteLog(e.what(), LMT_Error);
			 }
		 }

public : virtual void DrawFrame() 
		 {
			 _immediate_context->OM_SetRenderTarget(_render_window, NULL);
			 _immediate_context->RS_SetViewport(_viewport);
			 _immediate_context->ClearRenderTarget(_render_window, ColourValue::Green);
			 _render_window->Present();
		 }

public : virtual void Destroy() 
		 {
			 _driver->DestroyRenderWindow(_render_window);
			 _render_window = NULL;
		 }

private : Driver* _driver;
private : RenderWindow* _render_window;
private : DrawContext* _immediate_context;
private : Viewport _viewport;
};
